import { http } from "@/utils/http";

// 步骤1️⃣ 开始TOTP绑定
export const beginSetup = () => {
  return http.request<any>("post", "/api/auth/totp/begin-setup");
};

// 步骤2️⃣ 获取TOTP二维码PNG
export const getQrCode = (params: { setupId: string }) => {
  return http.request<any>("get", "/api/auth/totp/qr.png", {
    params,
    responseType: "blob",
    hideMessage: true
  });
};

// 步骤3️⃣ 启用TOTP
export const enableTotp = (data: { setupId: string; otpCode: string }) => {
  return http.request<any>("post", "/api/auth/totp/enable", {
    data
  });
};

// ✏️ 禁用TOTP
export const disableTotp = (data: { otpCode: string }) => {
  return http.request<any>("post", "/api/auth/totp/disable", {
    data
  });
};
// 📄 查询TOTP状态
export const getTotpStatus = () => {
  return http.request<any>("get", "/api/auth/totp/status");
};
